﻿using Quba.Business.Services.Abstract.Question;
using Quba.DataAccess.Repositories.Abstract;
using Quba.DataAccess.Repositories.Concrete;
using Quba.Entities.Database.General;
using Quba.Entities.Database.Question;

namespace Quba.Business.Services.Concrete.Question
{
    public class QuestionBusiness : IQuestionBusiness, IOptionBusiness, IQuestionPaperBusiness, IQuestionTypeBusiness, IAnswerPaperBusiness
    {
        #region Collaborators
        private readonly IQuestionRepository _questionRepository;
        private readonly IOptionRepository _optionRepository;
        private readonly IQuestionPaperRepository _questionPaperRepository;
        private readonly IQuestionTypeRepository _questionTypeRepository;
        private readonly IAnswerPaperRepository _answerPaperRepository;
        #endregion Collaborators

        #region ctor
        public QuestionBusiness()
        {
            _optionRepository =  new OptionRepository();
            _questionRepository = new QuestionRepository();
            _questionPaperRepository = new QuestionPaperRepository();
            _questionTypeRepository = new QuestionTypeRepository();
            _answerPaperRepository = new AnswerPaperRepository();
        }

        #endregion ctor

        #region Question

        public BaseEntity AddQuestionToBank(Entities.Database.Question.Question question)
        {
            return
                _questionRepository.Add(question);
        }

        public Entities.Database.Question.Question GetQuestionDetailsById(int questionId)
        {
            return
                _questionRepository.Get(questionId);
        } 
        #endregion Question

        #region Option
        public BaseEntity AddanOptionToQuestion(Option option)
        {
            return
                _optionRepository.Add(option);
        }
      
        public Option GetOptionDetailsById(int optionId)
        {
            return
                _optionRepository.Get(optionId);
        }
        #endregion Option

        #region QuestionPaper
        public BaseEntity AddQuestionPaper(QuestionPaper questionPaper)
        {
            return
                _questionPaperRepository.Add(questionPaper);
        }

        public QuestionPaper GetQuestionPaperDetailsById(int questionPaperId)
        {
            return
                _questionPaperRepository.Get(questionPaperId);
        }
        #endregion QuestionPaper

        #region QuestionType
        public BaseEntity AddQuestionType(QuestionType questionType)
        {
            return
                _questionTypeRepository.Add(questionType);
        }

        public QuestionType GetQuestionTypeDetails(int questionTypeId)
        {
            return
                _questionTypeRepository.Get(questionTypeId);
        }

        #endregion QuestionType

        #region AnswerPaper
        public BaseEntity AddAnswerPaper(AnswerPaper answerPaper)
        {
            return
                _answerPaperRepository.Add(answerPaper);
        }
        #endregion AnswerPaper
    }
}